package bb.lanxing.lib.devices.ble.cadence;

import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;

public interface IRemoteSwitchableCadenceController extends IInterface {


    class Default implements IRemoteSwitchableCadenceController {
        @Override
        public IBinder asBinder() {
            return null;
        }

        @Override
        public boolean switchTo(int i) throws RemoteException {
            return false;
        }
    }

    boolean switchTo(int i) throws RemoteException;

    abstract class Stub extends Binder implements IRemoteSwitchableCadenceController {
        private static final String DESCRIPTOR = "bb.lanxing.lib.devices.ble.cadence.IRemoteSwitchableCadenceController";
        static final int TRANSACTION_switchTo = 1;

        @Override
        public IBinder asBinder() {
            return this;
        }

        public Stub() {
            attachInterface(this, DESCRIPTOR);
        }

        public static IRemoteSwitchableCadenceController asInterface(IBinder iBinder) {
            if (iBinder == null) {
                return null;
            }
            IInterface queryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR);
            if ((queryLocalInterface instanceof IRemoteSwitchableCadenceController)) {
                return (IRemoteSwitchableCadenceController) queryLocalInterface;
            }
            return new Proxy(iBinder);
        }

        @Override
        public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
            if (i == TRANSACTION_switchTo) {
                parcel.enforceInterface(DESCRIPTOR);
                boolean switchTo = switchTo(parcel.readInt());
                parcel2.writeNoException();
                parcel2.writeInt(switchTo ? 1 : 0);
                return true;
            } else {
                if (i == INTERFACE_TRANSACTION) { //1598968902
                    parcel2.writeString(DESCRIPTOR);
                    return true;
                }
                return super.onTransact(i, parcel, parcel2, i2);
            }
        }

        public static class Proxy implements IRemoteSwitchableCadenceController {
            public static IRemoteSwitchableCadenceController sDefaultImpl;
            private final IBinder mRemote;

            public String getInterfaceDescriptor() {
                return Stub.DESCRIPTOR;
            }

            Proxy(IBinder iBinder) {
                this.mRemote = iBinder;
            }

            @Override
            public IBinder asBinder() {
                return this.mRemote;
            }

            @Override
            public boolean switchTo(int i) throws RemoteException {
                Parcel obtain = Parcel.obtain();
                Parcel obtain2 = Parcel.obtain();
                try {
                    obtain.writeInterfaceToken(Stub.DESCRIPTOR);
                    obtain.writeInt(i);
                    boolean z = false;
                    if (!this.mRemote.transact(1, obtain, obtain2, 0) && Stub.getDefaultImpl() != null) {
                        return Stub.getDefaultImpl().switchTo(i);
                    }
                    obtain2.readException();
                    if (obtain2.readInt() != 0) {
                        z = true;
                    }
                    return z;
                } finally {
                    obtain2.recycle();
                    obtain.recycle();
                }
            }
        }

        public static boolean setDefaultImpl(IRemoteSwitchableCadenceController iRemoteSwitchableCadenceController) {
            if (Proxy.sDefaultImpl == null) {
                if (iRemoteSwitchableCadenceController == null) {
                    return false;
                }
                Proxy.sDefaultImpl = iRemoteSwitchableCadenceController;
                return true;
            }
            throw new IllegalStateException("setDefaultImpl() called twice");
        }

        public static IRemoteSwitchableCadenceController getDefaultImpl() {
            return Proxy.sDefaultImpl;
        }
    }
}
